<!doctype html>
<html xmlns:th="http://www.w3.org/1999/xhtml">

<head>
    <th:block th:include="/A0723/include :: header('邀请链接')"/>
</head>
<body style="overflow: hidden;">
<header class="mui-bar mui-bar-transparent" style="background-color: transparent;">
    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
    <h1 class="mui-title" style="color: #fff;">邀请链接</h1>
</header>
<div class="mui-content" style="padding-top: 45px;">
    <!-- 背景 -->
    <div class="share_bg"></div>
    <!-- 文字 -->
    <div class="share_txt">
        <img class="share_txt" src="images/text.png" alt="">
    </div>


    <!-- 邀请码 -->
    <div class="yqm_bg">
        邀请码：<span id="code" data-clipboard-action="copy" data-clipboard-target="#code" class="btn"></span>
    </div>
<!--    &lt;!&ndash; 注册地址 &ndash;&gt;-->
<!--    <div class="yqm_bg">-->
<!--        注册地址：<textarea id="url" data-clipboard-action="copy" data-clipboard-target="#url" class="btn1"></textarea>-->
<!--    </div>-->
    <!-- 二维码 -->
    <div class="ewm_div">
        <div class="ewm_bg">
            <img class="ewm" id="qrCode" src="getQrCode" alt="">
        </div>
        <div>扫码注册</div>
    </div>
</div>
<th:block th:include="/A0723/include :: footer"/>
<script th:src="@{/front/js/dist/clipboard.min.js}"></script>
<script type="text/javascript">
    let code = ''
    var clipboard = new ClipboardJS('.btn', {
        text: function () {
            return code;
        }
    });

    clipboard.on('success', function (e) {
        console.info('Action:', e.action);
        console.info('Text:', e.text);
        console.info('Trigger:', e.trigger);
        mui.toast('已复制', {duration: 'long', type: 'div'})
    });

    clipboard.on('error', function (e) {
        console.error('Action:', e.action);
        console.error('Trigger:', e.trigger);
    });
    $(function () {
        getAppUser()
    })

    function getAppUser() {
        $.ajax(ctx+'front/getAppUser', {
            dataType: 'json',//服务器返回json格式数据
            type: 'get',//HTTP请求类型
            timeout: 10000,//超时时间设置为10秒；
            headers: {'Content-Type': 'application/json'},
            success: function (res) {
                code = res.data.referralCode
                $('#code').text(res.data.referralCode)
               // $('#url').text(res.data.qrCode)

            },
            error: function (xhr, type, errorThrown) {
                //异常处理；
                console.log(type);
            }
        });
    }
</script>
</body>

</html>
